from flask import Blueprint
from sale.apps.member.views import login, notify_order_view
from sale.apps.member.views import register
from sale.apps.member.views import select
from sale.apps.member.views import is_exist_by_name
from sale.apps.member.views import is_exist_by_phone
from sale.apps.member.views import send_verify_code
from sale.apps.member.views import image_verify_code
from sale.apps.member.views import admin_package_info
from sale.apps.member.views import pack_info_view
from sale.apps.member.views import get_myself_phone
from sale.apps.member.views import create_order_view
from sale.apps.member.views import my_orders_view
from sale.apps.member.views import order_detail_view



from sale.utils.image_verify_code import create_image_verify_code

users_bp = Blueprint('users', __name__)


users_bp.add_url_rule('/v1/users/action/login', methods=["POST"], view_func=login)
# 注册
users_bp.add_url_rule('/v1/users/action/register', methods=["POST"], view_func=register)
# 充值价格管理
users_bp.add_url_rule('/v1/users/action/admin_package_info', methods=["POST"], view_func=admin_package_info)
# 发送验证码信息
users_bp.add_url_rule('/v1/users/verifyCode', methods=["POST"], view_func=send_verify_code)
# 创建订单信息
users_bp.add_url_rule('/v1/create_order', methods=["POST"], view_func=create_order_view)
# 订单信息通知
users_bp.add_url_rule('/v1/order/notify', methods=["POST"], view_func=notify_order_view)


# 获取用户详情
users_bp.add_url_rule('/v1/users/myself/phone', methods=["GET"], view_func=get_myself_phone)
# 用户信息查询
users_bp.add_url_rule('/v1/users/<username>', methods=["GET"], view_func=select)
# 查询手机号是否存在
users_bp.add_url_rule('/v1/users/is_exist_by_phone', methods=["GET"], view_func=is_exist_by_phone)
# 查询用户名是否存在
users_bp.add_url_rule('/v1/users/is_exist_by_name', methods=["GET"], view_func=is_exist_by_name)
# 图片验证码
users_bp.add_url_rule('/v1/users/image_verify_code', methods=["GET"], view_func=image_verify_code)
# 创建图片验证
users_bp.add_url_rule('/v1/users/create_image_verify_code', methods=["GET"], view_func=create_image_verify_code)
# 获取套餐信息
users_bp.add_url_rule('/v1/pack_info', methods=["GET"], view_func=pack_info_view)
# 我的订单
users_bp.add_url_rule('/v1/users/my_orders_view', methods=["GET"], view_func=my_orders_view)
# 订单详情
users_bp.add_url_rule('/v1/users/order_detail', methods=["GET"], view_func=order_detail_view)





